/*
 * CGameState.h
 *
 *  Created on: 12.2.2009
 *      Author: jari.ravantti
 */

#ifndef CGameState_H_
#define CGameState_H_
#include "../basecode/CStateBase.h"
#include <iostream>
#include "../../graphics/basecode/CTextures.h"
#include "../../graphics/basecode/CFonts.h"
#include "../../graphics/basecode/CCamera.h"

#ifdef DEBUG
#include "../../logger/CLogger.h"
#endif
class CGameState: public CStateBase {
public:
	void Init();
	void Cleanup();

	void Pause();
	void Resume();

	void HandleEvents(CStateManager* main);
	void Update(CStateManager* main);
	void Draw(CStateManager* main);

	void resize(int x, int y);

	static CGameState* Instance() {
		return &m_CGameState;
	}

protected:
	CGameState() {
	}
	virtual ~CGameState() {
	}

	unsigned int m_Keys[SDLK_LAST];

private:
	static CGameState m_CGameState;

    /*drawing functions*/
    void drawGround();
    void drawHUD();
    void drawTank();
    void drawFire();

    /*vertext struct for drawing shapes*/
	struct Vertex
			{
				float x, y, z;

				Vertex(float x, float y, float z)
				{
					this->x = x;
					this->y = y;
					this->z = z;
				}
			};

			std::vector<Vertex> m_Vertices; //We have a vector of vertices, each vertex with its 3 coordinates
			std::vector<Vertex> m_Colors; //also 3 floats for colors, so we just use the Vertex-struct

    /*Textures*/
    CTextures *m_snow;

    CFonts* m_text;
    //char szText[256] = {0}; // Build The text String

    /*tank stuff*/
    float m_tankPosx;
    float m_tankPosy;
    float m_angle;
    bool  m_fire;
};
#endif /* CGameState_H_ */
